package com.example.client.javaapi;

import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

import static com.example.client.ZKConstans.CONNECTOR_STRING;

/**
 * @author Creared by wangyang on 2019-01-28 16:55
 * email:techyang.wangy.@ymm56.com
 */
public class ZookeeperFactory {


    public static ZooKeeper newZookeeper(int sessionTimeout, Watcher watcher) {
        try {
            return new ZooKeeper(CONNECTOR_STRING, sessionTimeout, watcher);
        } catch (IOException e) {
            return null;
        }
    }
}
